package lagou.homework.lagou_homework_rocketmq.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

public class Util {

    /**
     * redis的Date转
     * @param o
     * @return
     * @throws ParseException
     */
    public static Date toDate(Object o) throws ParseException {
        Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S").parse(o.toString());
        return date;
    }

    /**
     * 生成uuid
     * @return
     */
    public static String uuid(){
        String uuid = UUID.randomUUID().toString();
        uuid = uuid.replace("-","");
        return uuid;
    }
}
